<?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

/* JoomLeague League Management and Prediction Game for Joomla!
 * Copyright (C) 2007  Robert Moss
 *  
 * Homepage: http://www.joomleague.de
 * Support: htt://www.joomleague.de/forum/
 * 
 * This file is part of JoomLeague.
 *  
 * JoomLeague is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * Please note that the GPL states that any headers in files and
 * Copyright notices as well as credits in headers, source files
 * and output (screens, prints, etc.) can not be removed.
 * You can extend them with your own credits, though...
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 * The "GNU General Public License" (GPL) is available at
 * http://www.gnu.org/copyleft/gpl.html.
*/ 

?>

<!-- Hinweis f�r mich: Sprachdatei bearbeiten!! -->


<div id="right">
	<div id="rightpad">
	
<!-- Header Start -->	
		<div id="step">
			<div class="t">
        <div class="t">
          <div class="t"></div>
        </div>
      </div>
      <div class="m" align="left">
<?php if ($auto_update!=1) { ?>
				<div class="far-right">
							<div class="button1-left"><div class="help"><a href="http://www.joomleague.de/handbuch.html" alt="<?php echo _JL_ADMIN_MANUAL;?>" title="<?php echo _JL_ADMIN_MANUAL;?>" target="blank"><?php echo _JL_ADMIN_MANUAL;?></a></div></div>
							<div class="button1-left"><div class="forum"><a href="http://www.joomleague.de/forum/" alt="<?php echo _JL_ADMIN_FORUM;?>" title="<?php echo _JL_ADMIN_FORUM;?>" target="blank"><?php echo _JL_ADMIN_FORUM;?></a></div></div>
							<div class="button1-left"><div class="about"><a href="http://www.joomleague.de" alt="<?php echo _JL_ADMIN_INFO;?>" title="<?php echo _JL_ADMIN_INFO;?>" target="blank"><?php echo _JL_ADMIN_INFO;?></a></div></div>
				</div>
<?php } ?>
				<div class="button1-left"><div class="blank"><a href="index2.php?option=com_joomleague"></a></div></div><span class="step">JoomLeague - 0.91 darts patch</span>
			</div>
      <div class="b">
        <div class="b">
          <div class="b"></div>
        </div>
      </div>
    </div>
<!-- Header Ende --> 

    <div id="installer">
    
<!-- Bereichs�berschrift -->    
			<div class="t">
        <div class="t">
          <div class="t"></div>
        </div>
      </div>
      <div class="m" align="left">
      	<h2>Update Result</h2>		
<!-- Bereichs�berschrift Ende -->         		 
  
<!-- Info Bereich -->   			
		<div id="step">
			<div class="t">
        <div class="t">
          <div class="t"></div>
        </div>
      </div>
      <div class="m" align="left">
<table class="content" cellpadding="4">
 <tr>
  <td>

<?php
$defaultsplayervalues=0;
unset($queries);

$tables[0] = '#__joomleague_matches';
$fields = $database->getTableFields( $tables );
$fieldlist=implode(",",array_keys($fields[$tables[0]]));

if(!in_array('matchpart1_singles', array_keys($fields[$tables[0]]))) {
  $queries[]=array("ALTER TABLE `#__joomleague_matches` ADD COLUMN `matchpart2_triples` int(11) NOT NULL DEFAULT '0' AFTER `matchpart2_result`
                    , ADD COLUMN `matchpart1_triples` int(11) NOT NULL DEFAULT '0' AFTER `matchpart2_result`
                    , ADD COLUMN `matchpart2_doubles` int(11) NOT NULL DEFAULT '0' AFTER `matchpart2_result`
                    , ADD COLUMN `matchpart1_doubles` int(11) NOT NULL DEFAULT '0' AFTER `matchpart2_result`
                    , ADD COLUMN `matchpart2_singles` int(11) NOT NULL DEFAULT '0' AFTER `matchpart2_result`
                    , ADD COLUMN `matchpart1_singles` int(11) NOT NULL DEFAULT '0' AFTER `matchpart2_result`",
'Fields for singles, doubles, triples inserted in joomleague_matches table<br />');
}

$queries[]=array("ALTER TABLE `#__joomleague_match_events` CHANGE `event_sum` `event_sum` INT( 11 ) NOT NULL DEFAULT '1' ",
'Changed max for event sum<br />');
$ok_counter=0;
$ko_counter=0;
$total=count($queries);
if ($total) {
  foreach ($queries as $query) {
    $database->setQuery($query[0]);
    $database->query($query[0]);
    $bla=$database->getErrorNum();
    if($bla==0){ 
          echo '<img align="top" src="components/com_joomleague/images/ok.png" alt="OK" title"OK">';
          echo '&nbsp;';
          echo $query[1].'<br/>';
          $ok_counter++;}
    else{
    		  echo '<img align="top" src="components/com_joomleague/images/error.png" alt="Error" title"Error">'; 
          echo '&nbsp;';
          echo "<pre>".$database->getErrorMsg()."<br/>".$database->getQuery()."</pre><br/><br/>";
          $ko_counter++;}
  }
}

/*********************************
******** END
**********************************/

if ($ok_counter==$total)
{
	echo "<h1 align='center'>This update was succesful!</h1><center>(<b>$ok_counter of $total Queries</b> were done!)<br/>
<br />You can now use your updated JoomLeague Version!";
}
else echo "<h1 align='center'>This update was not succesful!</h1><center>(<b>$ko_counter Errors</b> occured and only <b>$ok_counter of $total Queries</b> were done!)<br/>
<br />You may have used this update allready or this update ist not compatible with your JoomLeague Version!";
    
?>

  </td>

 </tr>
</table>
			</div>
      <div class="b">
        <div class="b">
          <div class="b"></div>
        </div>
      </div>
    </div>
<!-- Info Bereich Ende -->     
  	
        <div class="clr"></div>
      </div>
      <div class="b">
        <div class="b">
          <div class="b"></div>
        </div>
      </div>
		</div>
	</div>
</div>
<div class="clr"></div>
